package treediff.wrapper.maintenance;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;

import org.htmlparser.Node;

public class ClusteredTreeMatchingRunnable implements Runnable {

	private Node n1;
	private Node n2;
	private String db;
	private String file1;
	private String file2;
	private BufferedWriter bw;

	public ClusteredTreeMatchingRunnable(Node n1, Node n2, String db, String file1, String file2, BufferedWriter bw) {
		
		this.n1 = n1;
		this.n2 = n2;
		this.db = db;
		this.file1 = file1;
		this.file2 = file2;
		this.bw = bw;
		
	}

	@Override
	public void run() {
		
		try {
			
			synchronized (bw) {
				bw.write("\n" + db + " - " + file1 + " - " + file2 + " - " + new ClusteredTreeMatching().clusteredTreeMatching(n1, n2, 1, 1));
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
